{extend name="base" /}
{block name="title"}历史资料{/block}
{block name="static"}
<link rel="stylesheet" type="text/css" media="screen" href="/static/pc/css/select.css"/>
{/block}
{block name="bread"}
<div class="bread-cram">
  <div class="bread-cram-inner">
    <span class="title">保险公司使用</span>
    <span class="sub-title">- 历史资料</span>
  </div>
</div>
{/block}

{block name="main"}
<input type="hidden" value="{$data.goods_info.p_id}" name ='p_id'>
          <div class="menu-content left">
            <div class="content-title">
              <p><span class="red name">{$data.info.stataus_str}</span></p>
            </div>
            {in name="data.status" value="2,3"}
            <div class="edit-detail-box">
              <label class="left">代录信息</label>
              <div class="edit-detail-content grey">
                <p>代录人姓名：{$data.info.recordor_name}</p>
                <p>代录人手机号：{$data.info.recordor_phone}</p>
                <p>代录人类型：{$data.info.recordor_type}</p>
                {if (!empty($data.info.recordor_commit) && $data.status ==2) }
                <p>请在{$data.info.recordor_commit |substr=0,10}  前录入递交</p>
                {/if}
              </div>
            </div>
            {/in}
            <div class="edit-detail-box">
              <label class="left">保单险种</label>
              <div class="edit-detail-content grey">
                <p>保单号：{$data.goods_info.report_num}</p>
                <p>报案号：{$data.goods_info.policy_num}</p>
                <p>出险险种：{$data.goods_info.insurance_type_name}</p>
              </div>
            </div>

            {notin name="data.status" value="2"}
            <div class="edit-detail-box">
              <label class="left">货品信息</label>
              <div class="edit-detail-content grey" id="prompt-ok-return">
                <p>货品类别：{$data.goods_info.goods_type_name}</p>
                <p>货品名称：{$data.goods_info.goods_name}</p>
                <p>数量与规格：{$data.goods_info.goods_num}</p>
                <p>物品原值：{if !empty($data.goods_info.good_price)}{$data.goods_info.good_price }万元{/if}</p>
                <p>评估价：{if !empty($data.goods_info.good_pg_price)}{$data.goods_info.good_pg_price }万元{/if}</p>
                {if $data.status == 0 && !empty($data.bohui_info.goods_return) }
                {volist name="data.bohui_info.goods_return" id="goods_return"}
                <p class="red">修改内容：{$goods_return}</p><br/>
                {/volist}
                {/if}
              </div>
              <!--修改-->
              {if $data.status ==0 && $data.is_recordor !=1 &&  !empty($data.bohui_info.situation_return)}
              <div class="edit red"><i class="iconfont-edit" id="goods_return_edit">&#xe62b;</i></div>
              <script>
                  $(document).on('click', '#goods_return_edit', function () {
                      $.get('{:url("Insurer/update1")}', {}, function(str){
                          layer.open({
                              type: 1,
                              title:'货品信息修改',
                              area: ['710px', '600px'], //宽高
                              content: str //注意，如果str是object，那么需要字符拼接。
                          });
                      });
                  })
                </script>
              {/if}
              <!--驳回-->
              {in name="data.status" value="3"}
              <div class="edit-btn" id="prompt-ok">驳回</div>
              <script>
                  $(document).on('click', '#prompt-ok', function () {
                      layer.prompt({
                          formType: 2,
                          // value: '初始值',
                          title: '请输入驳回信息',
                          yes:function(index,layero ){
                              var value =layero.find(".layui-layer-input").val();
                              var b=$('#prompt-ok-return').find('#prompt-ok-return-info');
                              if(value == '' && b.length>0){
                                  b.remove();
                                  $('#prompt-ok').text('驳回');
                                  layer.close(index);
                                  return;
                              }if(value == '' && b.length==0){
                                  $('#prompt-ok').text('驳回');
                                  layer.close(index);
                                  return;
                              }
                              if(b.length>0){
                                  $('#prompt-ok-return-info').text("修改内容："+value);
                                  $('#prompt-ok').text('修改驳回原因');
                              }else {
                                  $('#prompt-ok-return').append("<p class=\"red\" id= \"prompt-ok-return-info\">修改内容："+value+"</p>");
                                  $('#prompt-ok').text('修改驳回原因');
                              }
                              layer.close(index);
                          }
                      });
                  })
              </script>
              {/in}
            </div>
            <div class="edit-detail-box">
              <label class="left">货品受损</label>
              <div class="edit-detail-content grey" id="under_return-html">
                <p>受损时间：{$data.goods_info.damage_at |substr=0,10}</p>
                <p>受损原因：{$data.goods_info.damage_result}</p>
                <p>货品所在地：上海上海市浦东新区 长江西路123号进口厂库3号库</p>
                <p>第三方报告：调查报告.doc</p>
                {if $data.status == 0 && !empty($data.bohui_info.under_return) }
                {volist name="data.bohui_info.under_return" id="under_return"}
                <p class="red">修改内容：{$under_return}</p><br/>
                {/volist}
                {/if}
              </div>
              <!--修改-->
              {if $data.status ==0 && $data.is_recordor !=1  && !empty($data.bohui_info.under_return)}
              <div class="edit red"><i class="iconfont-edit">&#xe62b;</i></div>
              {/if}
              <!--驳回-->
              {in name="data.status" value="3"}
              <div class="edit-btn" id="under_return">驳回</div>
              <script>
                  $(document).on('click', '#under_return', function () {
                      layer.prompt({
                          formType: 2,
                          // value: '初始值',
                          title: '请输入驳回信息',
                          yes:function(index,layero ){
                              var value =layero.find(".layui-layer-input").val();
                              var b=$('#under_return-html').find('#under_return-info');
                              if(value == '' && b.length>0){
                                  b.remove();
                                  $('#under_return').text('驳回');
                                  layer.close(index);
                                  return;
                              }if(value == '' && b.length==0){
                                  $('#under_return').text('驳回');
                                  layer.close(index);
                                  return;
                              }
                              if(b.length>0){
                                  $('#under_return-info').text("修改内容："+value);
                                  $('#under_return').text('修改驳回原因');
                              }else {
                                  $('#under_return-html').append("<p class=\"red\" id= \"under_return-info\">修改内容："+value+"</p>");
                                  $('#under_return').text('修改驳回原因');
                              }
                              layer.close(index);
                          }
                      });
                  })
              </script>
              {/in}
            </div>
            <div class="edit-detail-box">
              <label class="left">货品现状</label>
              <div class="edit-detail-content grey" id ="situation-html">
                <p>货品在 {$data.goods_info.present_at|substr=0,10} 时的现状情况</p>
                <p>货品清单：货品清单.doc</p>
                <p>货品现状描述：{$data.goods_info.goods_desc}</p>
                <div class="pre-view-box">
                  <label>上传的照片：</label>
                  {if !empty($data.goods_info.present_img)}
                  {volist name="data.goods_info.present_img" id="vo"}
                  <div class="pre-view"> <img src="{$vo}" style="width: 2.5rem;height: 2.5rem" class="i"></div>
                  {/volist}
                  {/if}
                </div>
                <div class="pre-view-box">
                  <label>上传的视频：</label>
                  <div class="pre-view">预览</div>
                </div>
                {if $data.status == 0 && !empty($data.bohui_info.situation_return) }
                {volist name="data.bohui_info.situation_return" id="situation_return"}
                <p class="red">修改内容：{$situation_return}</p><br/>
                {/volist}
                {/if}
              </div>
              <!--修改-->
              {if $data.status ==0 && $data.is_recordor !=1  && !empty($data.bohui_info.situation_return)}
              <div class="edit red"><i class="iconfont-edit">&#xe62b;</i></div>
              {/if}
              <!--驳回-->
              {in name="data.status" value="3"}
              <div class="edit-btn" id="situation_return">驳回</div>
              <script>
                  $(document).on('click', '#situation_return', function () {
                      layer.prompt({
                          formType: 2,
                          // value: '初始值',
                          title: '请输入驳回信息',
                          yes:function(index,layero ){
                              var value =layero.find(".layui-layer-input").val();
                              var b=$('#situation-html').find('#situation_info');
                              if(value == '' && b.length>0){
                                  b.remove();
                                  $('#situation_return').text('驳回');
                                  layer.close(index);
                                  return;
                              }if(value == '' && b.length==0){
                                  $('#situation_return').text('驳回');
                                  layer.close(index);
                                  return;
                              }
                              if(b.length>0){
                                  $('#situation_info').text("修改内容："+value);
                                  $('#situation_return').text('修改驳回原因');
                              }else {
                                  $('#situation-html').append("<p class=\"red\" id= \"situation_info\">修改内容："+value+"</p>");
                                  $('#situation_return').text('修改驳回原因');
                              }
                              layer.close(index);
                          }
                      });
                  })
              </script>
              {/in}
            </div>
            <div class="edit-detail-box">
              <label class="left">物权信息</label>
              <div class="edit-detail-content grey" id="info_html">
                <p>要求在 {$data.goods_info.should_at|substr=0,10} 前处置完成</p>
                <p>物权单位：{$data.goods_info.rem_company}</p>
                <p>联系人：{$data.goods_info.linkman}</p>
                <p>手机号：{$data.goods_info.connect_phone}</p>
                {if $data.status == 0 && !empty($data.bohui_info.info_return) }
                {volist name="data.bohui_info.info_return" id="info_return"}
                <p class="red">修改内容：{$info_return}</p><br/>
                {/volist}
                {/if}
              </div>
              <!--修改-->
              {if $data.status ==0 && $data.is_recordor !=1  && !empty($data.bohui_info.info_return)}
              <div class="edit red"><i class="iconfont-edit">&#xe62b;</i></div>
              {/if}
              <!--驳回-->
              {in name="data.status" value="3"}
              <div class="edit-btn" id="info_return">驳回</div>
              <script>
                  $(document).on('click', '#info_return', function () {
                      layer.prompt({
                          formType: 2,
                          // value: '初始值',
                          title: '请输入驳回信息',
                          yes:function(index,layero ){
                              var value =layero.find(".layui-layer-input").val();
                              var b=$('#info_html').find('#info_info');
                              if(value == '' && b.length>0){
                                  b.remove();
                                  $('#info_return').text('驳回');
                                  layer.close(index);
                                  return;
                              }if(value == '' && b.length==0){
                                  $('#info_return').text('驳回');
                                  layer.close(index);
                                  return;
                              }
                              if(b.length>0){
                                  $('#info_info').text("修改内容："+value);
                                  $('#info_return').text('修改驳回原因');
                              }else {
                                  $('#info_html').append("<p class=\"red\" id= \"info_info\">修改内容："+value+"</p>");
                                  $('#info_return').text('修改驳回原因');
                              }
                              layer.close(index);
                          }
                      });
                  })
              </script>
              {/in}
            </div>
            {notin name="data.status" value="3"}
            <div class="edit-detail-box">
              <label class="left">授权书</label>
              <div class="edit-detail-content grey">

                <div class="pre-view-box"><div class="pre-view"> {if !empty($data.goods_info.author_report)} <img src="{$data.goods_info.author_report}" style="width: 2.5rem;height: 2.5rem" class="i"> {/if}</div></div>
              </div>

            </div>
            {/notin}
            {/notin}

            <div class="form-footer">
              <div class="step-btn-box">
                {in name="data.status" value="1"}
                <div class="save-btn">编辑递交</div>
                {/in}
                {in name="data.status" value="0"}
                <div class="save-btn">修改完提交</div>
                {/in}
                {in name="data.status" value="3"}
                <div class="pre-btn" id="reject">提交驳回修改</div>
                <div class="next-btn">上传授权书并递交</div>
                <script>
                    $('#reject').on('click', function () {
                        var goods_return = $("#prompt-ok-return-info").text();
                        var under_return = $("#under_return-info").text();
                        var situation_return = $("#situation_info").text();
                        var info_return = $("#info_info").text();
                        var p_id = $("input[ name='p_id']").val();
                        if(goods_return == '' && under_return=='' && situation_return=='' && info_return==''){
                            layer.msg('没有驳回原因', {icon: 2});
                            return;
                        }
                        if(goods_return != ''){
                            var a= goods_return.split('：');
                            goods_return=a[1];
                        }else {
                            goods_return='';
                        }
                        if(under_return != ''){
                            var b= under_return.split('：');
                            under_return=b[1];
                        }else {
                            under_return='';
                        }
                        if(situation_return != ''){
                            var c= situation_return.split('：');
                            situation_return=c[1];
                        }else {
                            situation_return='';
                        }
                        if(info_return != ''){
                            var d= info_return.split('：');
                            info_return = d[1];
                        }else {
                            info_return='';
                        }
                        $.ajax({
                            type: 'POST',
                            url: "{:url('insurer/reject')}",
                            data: {
                                'p_id': p_id,
                                'goods_return': goods_return,
                                'under_return': under_return,
                                'situation_return': situation_return,
                                'info_return': info_return
                            },
                            dataType: 'json',
                            success: function (Json) {
                                if (Json.code == 200) {
                                    layer.msg('驳回成功', {icon: 1});
                                    window.history.go(-1);location.reload();
                                } else {
                                    $.alert(Json.msg);
                                    layer.msg(Json.msg, {icon: 2});
                                }
                            }
                        });

                    });


                </script>

                {/in}

              </div>
            </div>

          </div>
          <div class="clear"></div>
{/block}

{block name="js"}
<script type="text/javascript">
  layui.use(['layer'], function(){
  $('.i').on('click',function(){
  var th=$(this);
  var img=th[0].currentSrc;
   layer.open({
   type: 1,
   title: false,
   closeBtn: 0,
   area: '80%',
   skin: 'layui-layer-nobg', //没有背景色
   shadeClose: true,
   content:'<img src="'+img+'" style="width:100% ;">'
   });
   });
   });
  $(document).on('click', '#addr', function() {
      layer.msg('响应点击事件');
  });
  $(document).on('click', '.demo', function() {
      fSelect();
  });
//  $(document).on('click', '.demo').fSelect();
</script>
{/block}
